package io.web.bi.converter;

import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;

/**
 * AbstractConverter.
 *
 * @date 2023-07-24
 */
public abstract class AbstractConverter<T> implements Converter<T> {

    @Override
    public T convert(String value) {
        if (value == null) {
            throw new NullPointerException("The value must not be null");
        }
        if (StringUtils.isBlank(value)) {
            return null;
        }
        return doConvert(value);
    }

    protected abstract T doConvert(String value);
}
